import Mock from "mockjs";
import menuAPI from "./menu";

import purchaseAPI from "@/app/inquiry/mock/purchase-list";
import ListqueryAPI from "@/app/example/listQuery/mock/listQuery";
import settlementList from "@/app/settlement-management/settlement-maintenance-approval/mock/settlementList";

// import navTable from "@/app/example/appNav/mock/nav-table";
import publishList from "@/app/inquiry/mock/publish-list";
import inquiryApi from "@/app/inquiry/mock/inquiry";
// import settlementWritten from "@/app/settlement-management/settlement-written-off/mock/settlement-all";

// 修复在使用 MockJS 情况下，设置 withCredentials = true，且未被拦截的跨域请求丢失 Cookies 的问题
// https://github.com/nuysoft/Mock/issues/300
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send;
Mock.XHR.prototype.send = function() {
  if (this.custom.xhr) {
    this.custom.xhr.withCredentials = this.withCredentials || false;
  }
  this.proxy_send(...arguments);
};

Mock.setup({
  timeout: "350-600"
});

// demo工程数据模拟接口
// Mock.mock(/\/queryDemoList/, "post", demoListAPI.getData);

Mock.mock(/\/apis\/smp\/app\/getAuthMenu/, "post", menuAPI.getData());

// Mock.mock(/\/apis\/gepma\/app\/getAuthMenu/, "post", menuAPI.getData);

// 列表查询模拟接口
Mock.mock("/apis/gepma/listQuery", "get", ListqueryAPI.getData);

// 墨迹数据
Mock.mock("/apis/smp/settlementList", "get", settlementList.getData);

// Mock.mock(/\/apis\/demo\/features\/navTable/, "post", navTable.getData);

Mock.mock(/\/apis\/emoma\/cc\/queryApprovalList/, "post", publishList.getData);

Mock.mock(/\/order\/org/, "post", inquiryApi.getData);
Mock.mock(/\/purchase\/org/, "post", purchaseAPI.getData);
// Mock.mock(
//   /\/apis\/smp\/smp\/listSmpPcConcPage/,
//   "post",
//   settlementWritten.getData
// );

export default Mock;
